package com.jade.zsy.purchase.facade.impl;

import com.jade.bss.DbException;
import com.jade.bss.base.utils.CopyBean;
import com.jade.bss.db.impl.BaseFacadeImpl;
import com.jade.framework.base.criterion.Criteria;
import com.jade.framework.base.util.PagingList;
import com.jade.framework.base.util.PagingResult;
import com.jade.zsy.purchase.dao.PODetailDao;
import com.jade.zsy.purchase.entity.PODetail;
import com.jade.zsy.purchase.service.PODetailFacade;
import com.jade.zsy.purchase.vo.PODetailVo;
import org.springframework.stereotype.Service;

import javax.inject.Inject;
import javax.inject.Named;

/**
 * 员工信息表
 * User: jinya
 * Date: 2017/5/31
 * Time: 11:07
 * TEL :17701640710   MAIL:2009_jinya@163.com
 * To change this template use File | Settings | File Templates.
 */
@Service("PODetailFacade")
public class PoDetailFacadeImpl extends BaseFacadeImpl implements PODetailFacade {

    @Inject
    @Named("PODetailDao")
    private PODetailDao poDetailDao;

    @Override
    public PagingResult queryEntity(Object obj, int page, int size, String keys, String... orders) throws DbException,IllegalAccessException, InstantiationException {
        PODetailVo entity=(PODetailVo)obj;
        Criteria criteria = new Criteria((page - 1) * size, size);

        PagingList pagingList = poDetailDao.queryEntity(PODetail.class, criteria);
        PagingResult result = PagingResult.getResult(CopyBean.copy(pagingList, PODetailVo.class), pagingList.getTotalCount(), page, size);
        return result;
    }
}
